package com.hw.mapreduce.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hw.mapreduce.service.WordCountMRService;

@Controller
public class HDFSController {

	private static Logger log=LoggerFactory.getLogger(HDFSController.class);
	@Autowired
	private WordCountMRService mrservice;

	@RequestMapping("/wordCount")
	@ResponseBody
	public String wordCount(String inputPath, String outputPath){
		String msg="计算成功！";
		
		try{
			mrservice.doWordCount(inputPath, outputPath);
		}catch(Exception e){
			msg="计算失败！";
		}
		return msg;
	}
}